import { ref, computed, type Ref } from "vue";
import { defineStore } from "pinia";

import { getRecommend } from "@/api/index";

export const useCounterStore = defineStore("counter", () => {
  const count: Ref<number> = ref(10);
  const doubleCount: Ref<number> = computed(() => count.value * 2);
  function increment() {
    count.value++;
  }

  // const recommend = ref({});
  async function updataRecommend() {
    const res = await getRecommend();
    // recommend.value = res.data;
    console.log(res.data);
  }

  return {
    count,
    doubleCount,
    increment,
    // recommend,
    updataRecommend,
  };
});
